<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<html lang="en">
<head>
    <th:block th:include="include :: header('修改商城配置信息')" />
</head>
<body  class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-homeconfig-update" action="updatehome" method="post">
        <div class="col-md-12">
            <input type="hidden">
            <input name="id" type="hidden" th:value="${shopConfig.id}" />
            <div class="form-group">
                <label class="col-sm-3 control-label">模块一名称：</label>
                <div class="col-sm-9">
                    <input type="text" name="module1Name" class="form-control" placeholder="请输入模块名称" th:value="${shopConfig.module1Name}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">模块一图片：</label>
                <div class="col-sm-8">
                    <button type="button" class="layui-btn" id="upload_module1">上传图片</button>
                    <div class="layui-upload-list">
                        <input type="hidden" id="module1Img" th:value="${shopConfig.module1Img}" name="module1Img">
                        <p id="show_module1Img">
                            <img th:src="${shopConfig.module1Img}">
                        </p>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">模块二名称：</label>
                <div class="col-sm-9">
                    <input type="text" name="module2Name" class="form-control" placeholder="请输入模块名称" th:value="${shopConfig.module2Name}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">模块二图片：</label>
                <div class="col-sm-8">
                    <button type="button" class="layui-btn" id="upload_module2">上传图片</button>
                    <div class="layui-upload-list">
                        <input type="hidden" id="module2Img" th:value="${shopConfig.module2Img}" name="module2Img">
                        <p id="show_module2Img">
                            <img th:src="${shopConfig.module2Img}">
                        </p>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">免责声明：</label>
                <div class="col-sm-9">
                    <textarea name="disclaimer" class="form-control" th:text="${shopConfig.disclaimer}"></textarea>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-12 col-sm-offset-3">
                    <button type="submit" class="btn btn-primary">提交</button>
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
</body>
<script>
    // var prefix = ctx + "system/shopconfig";
    // function submitHandler() {
    //     if ($.validate.form()) {
    //         console.log(prefix + "/updatehome")
    //         $.operate.save(prefix + "/updatehome", $('#form-homeconfig-update').serialize());
    //     }
    // }


    layui.use('upload', function () {
        var $ = layui.jquery
            , upload = layui.upload;

        //普通图片上传
        var uploadInst = upload.render({
            elem: '#upload_module1'
            , url: '/common/upload' //改成您自己的上传接口
            , done: function (res) {
                //如果上传失败
                if (res.code > 0) {
                    return layer.msg('上传失败');
                }
                //上传成功
                $("#show_module1Img").html("<img src='" + res.url + "'>");
                $("#module1Img").val(res.url);
            }
            , error: function () {
                //演示失败状态，并实现重传
                var demoText = $('#demoText1');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function () {
                    uploadInst.upload();
                });
            }
        });
    })
    layui.use('upload', function () {
        var $ = layui.jquery
            , upload = layui.upload;

        //普通图片上传
        var uploadInst = upload.render({
            elem: '#upload_module2'
            , url: '/common/upload' //改成您自己的上传接口
            , done: function (res) {
                //如果上传失败
                if (res.code > 0) {
                    return layer.msg('上传失败');
                }
                //上传成功
                $("#show_module2Img").html("<img src='" + res.url + "'>");
                $("#module2Img").val(res.url);
            }
            , error: function () {
                //演示失败状态，并实现重传
                var demoText = $('#demoText1');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function () {
                    uploadInst.upload();
                });
            }
        });
    })
</script>
</html>